package org.wombat.model;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: rovsipet
 * Date: 24-11-2010
 * Time: 09:05:23
 * To change this template use File | Settings | File Templates.
 */
public class UserCache {

    private Map<String,User> cache = new HashMap<String, User>();

    public UserCache()
    {
       User a = new User("a","a");
        a.setForName("Peter");
        a.setLastName("Rovsing");
       User b = new User("b","b");
        b.setForName("Louise");
        b.setLastName("Rovsing");
       User c = new User("c","c");
        c.setForName("Pusle");
        c.setLastName("Rovsing");
       User d = new User("d","ds");
        d.setForName("Mickey");
        d.setLastName("Mouse");

        cache.put("a",a);
        cache.put("b",b);
        cache.put("c",c);
        cache.put("d",d);
    }

    public User getUserByUsername(String username){
        return cache.get(username);
    }

    public boolean addUser(User user) {
        cache.put(user.getUserName(),user) ;
        return true;
    }
}
